<?php include 'application/views/header.php' ?>
<h4 class="page-title">Khách hàng</h4>
<div class="toolbar-set">
    <input type="button" class="btnAdd" value="Thêm video" />
</div>
<table width="100%" class="list list-videos">
    <tr>
        <th>STT</th>
        <th>Tên video</th>
        <th>Embed</th>
        <th>Hiển thị</th>
        <th>Thao tác</th>
    </tr>
    <?php $index = 1 ?>
    <?php foreach($Videos as $video): ?>
    <tr>
       <td><?php echo $index++ ?></td>
       <td><?php echo $video['VideoName'] ?></td>
       <td><?php echo $video['Embed'] ?></td>
       <td><?php echo ($video['Visible'] ? 'Hiện' : 'Ẩn')?></td>
       <td>
            <a href="<?php echo base_url() ?>video/edit/<?php echo $video['VideoId'] ?>.html">
                <div class="actEdit">Edit</div>
            </a>
            <a href="#">
                <div class="actDelete" videoId="<?php echo $video['VideoId'] ?>">Edit</div>
            </a>
       </td>
    </tr>
    <?php endforeach; ?>
</table>
<div class="toolbar-set">
    <input type="button" class="btnAdd" value="Thêm video" />
</div>

<?php include 'application/views/footer.php' ?>

<script>
$('.btnAdd').click(function(){
    window.location.href = '<?php echo base_url() ?>video/add.html'; 
});
$('.actDelete').click(function(){
    var videoId = $(this).attr('videoId');
    if(confirm("Bạn có muốn xóa không?")){
        window.location.href = '<?php echo base_url() ?>video/delete/'+videoId;
    }
    return false;
});
</script>